package jz.utils;

import java.io.IOException;

public class NumberTools {

	private static class SingletonHolder {
		private static NumberTools INSTANCE = new NumberTools();
	}

	public static NumberTools getInstance() {
		return SingletonHolder.INSTANCE;
	}
	
	public boolean isNumeric2(String str){
		for (int i = str.length();--i>=0;){
		   if (!Character.isDigit(str.charAt(i))){
		    return false;
		   }
		}
		return true;
	}
	
	public byte[] getByte(byte[] value) throws IOException {
		byte[] c = null;
		if(null != value){
			java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(value);
			try {
				java.io.DataInputStream in = new java.io.DataInputStream(bin);
				try {
					in.readUTF();
					in.readUTF();
					in.readInt();
					c = new byte[in.available()];
					in.read(c, 0, c.length);
				} finally {
					in.close();
				}
			} finally {
				bin.close();
			}
		}
		return c;
	}
}
